home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
Documents
/
NeXTAnswers
/
netinfo.362
< prev
next >
Wrap
Text File
|
1992-02-06
|
1KB
|
62 lines
{\rtf0\ansi{\fonttbl\f2\fnil Times-Roman;\f0\fmodern Courier;}
\paperw11440
\paperh9000
\margl120
\margr120
\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f2\b0\i0\ul0\fs24 NetInfo print directory\
\
Q: How do I print an entire NetInfo directory?\
\
A: Following is a Bourne Shell script which will do the trick.\
\
\f0\fs22 #! /bin/sh\
#\
# niprint utility - print all the properties of a directory in a NetInfo domain\
#\
# niprint directory [domain]\
\
DEFAULT_DOMAIN=.\
NAME=`basename $\{0\}`\
PATH=/usr/etc:/usr/bin:/bin\
\
USAGE="Usage: $\{NAME\} directory [domain]"\
\
readonly DEFAULT_DOMAIN NAME PATH USAGE\
\
ArgC=$#\
\
if [ $\{ArgC\} -lt 1 ]; then\
echo 1>&2 "$\{NAME\}: too few arguments"\
echo 1>&2 $\{USAGE\}\
exit 1\
fi\
\
Directory=$\{1\}\
\
if [ $\{ArgC\} -gt 1 ]; then\
Domain=$\{2\}\
if [ $\{ArgC\} -gt 2 ]; then\
echo 1>&2 "$\{NAME\}: too many arguments; only two used"\
echo 1>&2 $\{USAGE\}\
fi\
else\
Domain=$\{DEFAULT_DOMAIN\}\
fi\
\
for SubDirectory in `niutil -list $\{Domain\} $\{Directory\} | \\\
awk '\{print $2\}'`; do\
echo $\{Domain\}:$\{Directory\}/$\{SubDirectory\}\
niutil -read $\{Domain\} $\{Directory\}/`echo $\{SubDirectory\} | sed 's-/-\\\\\\\\/-g'`\
echo ""\
done\
\f2\fs24 \
QA362\
\
Valid for 1.0\
Valid for 2.0\
\